//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Eas.WebCrawler.Model.Actions;
using Eas.WebCrawler.Interfaces;

namespace Eas.WebCrawler.Test.Model {
    /// <summary>
    /// Summary description for BaseActionFactoryTest
    /// </summary>
    [TestClass]
    public class BaseActionFactoryTest {
        public BaseActionFactoryTest() {
            //
            // TODO: Add constructor logic here
            //
        }

        BaseActionFactory _Factory = null;

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        [TestInitialize()]
        public void MyTestInitialize() {
            _Factory = new BaseActionFactory();
        }

        // Use TestCleanup to run code after each test has run
        [TestCleanup()]
        public void MyTestCleanup() {
            _Factory = null;
            GC.Collect();
        }
        //
        #endregion

        [TestMethod]
        /// <summary>Executes the TextWorkerStates test.</summary>
        public void TextWorkerStates() {
            _Factory.Initialize(null);
            Assert.AreEqual<WorkerState>(WorkerState.Working, _Factory.CreateGetRequestAction(null, null).WorkerState);
            Assert.AreEqual<WorkerState>(WorkerState.Working, _Factory.CreateGetResponseAction(null, null).WorkerState);
            Assert.AreEqual<WorkerState>(WorkerState.Working, _Factory.CreateInitialAction(null, null).WorkerState);
            Assert.AreEqual<WorkerState>(WorkerState.Paused, _Factory.CreatePauseAction(null, null).WorkerState);
            Assert.AreEqual<WorkerState>(WorkerState.Working, _Factory.CreateStreamReadAction(null, null).WorkerState);
            Assert.AreEqual<WorkerState>(WorkerState.Stopped, _Factory.CreateTerminalAction(null, null).WorkerState);
        }


    }
}
